/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ve.com.cantv.worktables.ejb.entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Ghust
 */
@Entity
@Table(name = "u_user")
@NamedQueries({@NamedQuery(name = "UUser.findAll", query = "SELECT u FROM UUser u"), @NamedQuery(name = "UUser.findByIduser", query = "SELECT u FROM UUser u WHERE u.iduser = :iduser"), @NamedQuery(name = "UUser.findByIdusersap", query = "SELECT u FROM UUser u WHERE u.idusersap = :idusersap"), @NamedQuery(name = "UUser.findByPassword", query = "SELECT u FROM UUser u WHERE u.password = :password"), @NamedQuery(name = "UUser.findByEmail", query = "SELECT u FROM UUser u WHERE u.email = :email"), @NamedQuery(name = "UUser.findByUsercreate", query = "SELECT u FROM UUser u WHERE u.usercreate = :usercreate"), @NamedQuery(name = "UUser.findByDatechange", query = "SELECT u FROM UUser u WHERE u.datechange = :datechange")})
public class UUser implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "iduser")
    private Integer iduser;
    @Basic(optional = false)
    @Column(name = "idusersap")
    private String idusersap;
    @Basic(optional = false)
    @Column(name = "password")
    private String password;
    @Column(name = "email")
    private String email;
    @Column(name = "usercreate")
    private Integer usercreate;
    @Column(name = "datechange")
    @Temporal(TemporalType.DATE)
    private Date datechange;
    @OneToMany(mappedBy = "iduser",fetch=FetchType.LAZY)
    private Collection<Module> moduleCollection;
    @OneToMany(mappedBy = "iduser")
    private Collection<Roltask> roltaskCollection;
    @OneToMany(mappedBy = "iduser")
    private Collection<Task> taskCollection;
    @OneToMany(mappedBy = "iduser")
    private Collection<Rolmodule> rolmoduleCollection;
    @JoinColumn(name = "idrol", referencedColumnName = "idrol")
    @ManyToOne
    private Rol idrol;

    public UUser() {
    }

    public UUser(Integer iduser) {
        this.iduser = iduser;
    }

    public UUser(Integer iduser, String idusersap, String password) {
        this.iduser = iduser;
        this.idusersap = idusersap;
        this.password = password;
    }

    public Integer getIduser() {
        return iduser;
    }

    public void setIduser(Integer iduser) {
        this.iduser = iduser;
    }

    public String getIdusersap() {
        return idusersap;
    }

    public void setIdusersap(String idusersap) {
        this.idusersap = idusersap;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Integer getUsercreate() {
        return usercreate;
    }

    public void setUsercreate(Integer usercreate) {
        this.usercreate = usercreate;
    }

    public Date getDatechange() {
        return datechange;
    }

    public void setDatechange(Date datechange) {
        this.datechange = datechange;
    }

    public Collection<Module> getModuleCollection() {
        return moduleCollection;
    }

    public void setModuleCollection(Collection<Module> moduleCollection) {
        this.moduleCollection = moduleCollection;
    }

    public Collection<Roltask> getRoltaskCollection() {
        return roltaskCollection;
    }

    public void setRoltaskCollection(Collection<Roltask> roltaskCollection) {
        this.roltaskCollection = roltaskCollection;
    }

    public Collection<Task> getTaskCollection() {
        return taskCollection;
    }

    public void setTaskCollection(Collection<Task> taskCollection) {
        this.taskCollection = taskCollection;
    }

    public Collection<Rolmodule> getRolmoduleCollection() {
        return rolmoduleCollection;
    }

    public void setRolmoduleCollection(Collection<Rolmodule> rolmoduleCollection) {
        this.rolmoduleCollection = rolmoduleCollection;
    }

    public Rol getIdrol() {
        return idrol;
    }

    public void setIdrol(Rol idrol) {
        this.idrol = idrol;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (iduser != null ? iduser.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof UUser)) {
            return false;
        }
        UUser other = (UUser) object;
        if ((this.iduser == null && other.iduser != null) || (this.iduser != null && !this.iduser.equals(other.iduser))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ve.com.cantv.worktables.ejb.entity.UUser[iduser=" + iduser + "]";
    }

}
